package com.sicheng.lc.杂题.括号系列;

import java.util.*;


/**
 * @author zsc
 * @version 1.0
 * @date 2022/7/14 15:45
 */
public class 最长合法子串 {
    //https://www.acwing.com/problem/content/description/4201/
    // 维护一个栈 对于一个右括号而言有且只能有一个和他抵消
    // 当栈内无左括号抵消时 把右括号直接纳入栈顶 可以断层
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        ArrayDeque<Integer> stack = new ArrayDeque<>(100);
        stack.push(-1);
        int res = 0, count = 0;
        for (int i = 0; i < s.length(); i++) {
            if (stack.size() > 1 && s.charAt(stack.peek()) == '(' && s.charAt(i) == ')')
                stack.pop();
            else
                stack.push(i);
            assert !stack.isEmpty();
            int d = i - stack.peek();
            if (d != 0 && d > res) {
                res = d;
                count = 1;
            } else if (d != 0 && d == res) {
                count++;
            }
        }
        if (res == 0)
            System.out.printf("%d %d", 0, 1);
        else
            System.out.printf("%d %d", res, count);
    }
}
